/**
 * @file /include/st_bioTacGui/qnode.hpp
 * @author Tomonori Yamamoto <tomonori.yamamoto@syntouchllc.com>
 *         (originally written by Daniel Stonier)
 * @date December 02, 2011
 * @brief Communications central!
 **/
/*****************************************************************************
** Ifdefs
*****************************************************************************/

#ifndef st_biotac_gui_qnode_hpp
#define st_biotac_gui_qnode_hpp

/*****************************************************************************
** Includes
*****************************************************************************/

#include <ros/ros.h>
// #include <sr_robot_msgs/Biotac.h>
// #include <sr_robot_msgs/BiotacAll.h>
#include "st_biotac_gui/Biotac.h"
#include "st_biotac_gui/BiotacAll.h"
#include <string>
#include <QThread>
#include <QStringListModel>

/*****************************************************************************
** Namespaces
*****************************************************************************/

namespace syntouch_biotac_gui {

struct BiotacData
{
  int pac0;
  int pac1;
  int pdc;
  int tac;
  int tdc;
  int electrodes[19];
};

/*****************************************************************************
 ** Class
 *****************************************************************************/

class QNode : public QThread
{
  Q_OBJECT
  
public:
  QNode(int argc, char** argv);
  ~QNode();
  bool init();
  void run();
  void callback(const st_biotac_gui::BiotacAll::ConstPtr& msg);
  BiotacData* getData();

signals:
  void rosShutdown();
  void dataUpdated();

private:
  int init_argc_;
  char** init_argv_;
  ros::Subscriber chatter_subscriber_;
  static const int num_sensing_electrodes_;
  static const int num_biotacs_;
  BiotacData data_[5];
};

}  // namespace syntouch_biotac_gui

#endif /* st_biotac_gui_qnode_hpp */
